//
//  EFOrderMoreCell.m
//  EnjogFood
//
//  Created by 王芳 on 17/5/13.
//  Copyright © 2017年 wf. All rights reserved.
//

#import "EFOrderMoreCell.h"
#import "EFOrderOpenItem.h"

@interface EFOrderMoreCell ()
@property (strong, nonatomic) UILabel *openLabel;
@property (strong, nonatomic) UIImageView *arrowImageV;
@end

@implementation EFOrderMoreCell

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self initUI];
    }
    return self;
}

- (void)initUI{
    [self.contentView addSubview:self.openLabel];
    [self.contentView addSubview:self.arrowImageV];
}

- (void)setObject:(EFOrderOpenItem *)item{
    self.openLabel.text = [NSString stringWithFormat:@"展开其他%d件",item.count];
    [self.openLabel sizeToFit];
    self.openLabel.left =  (kScreenWidth - self.openLabel.width - self.arrowImageV.width)/2;
    self.openLabel.top = 10;
    
    self.arrowImageV.left = self.openLabel.right + 2;
    self.arrowImageV.top = 8;
}

- (UILabel *)openLabel{
    if (!_openLabel) {
        _openLabel = [[UILabel alloc] init];
        _openLabel.font = [UIFont systemFontOfSize:13];
        _openLabel.textColor = kBlack999;
    }
    return _openLabel;
}

- (UIImageView *)arrowImageV{
    if (!_arrowImageV) {
        _arrowImageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 20, 20)];
        _arrowImageV.image = IMG(@"unfolded_icon__default");
    }
    return _arrowImageV;
}

@end
